import httpUtils from "@/core/utils/http.utils";
// service path
const urls = {
    'getSysMenuPage': `/api/upms/sysMenu/tree`,
    'getSysMenuById': `/api/upms/sysMenu/`,
    'saveSysMenu': `/api/upms/sysMenu`,
    'updateSysMenuById': `/api/upms/sysMenu`,
    'deleteSysMenuById': `/api/upms/sysMenu/`,
};
// service methods
const sysMenuApi = {
    getSysMenuPage (params) {
        return httpUtils.get(urls.getSysMenuPage, params);
    },
    getSysMenuById(id) {
        return httpUtils.get(urls.getSysMenuById + id, {});
    },
    saveSysMenu(params) {
        return httpUtils.postRequest(urls.saveSysMenu, params);
    },
    updateSysMenuById(params) {
        return httpUtils.put(urls.updateSysMenuById, params);
    },
    deleteSysMenu(ids) {
        let url = "";
        ids.forEach((item, index) => {
            if ("" !== url) {
                url = url + "&";
            }
            url = url + "id=" + item;
        })
        return httpUtils.delete(urls.deleteSysMenuById+ids);
    },

};

export default sysMenuApi;
